<template>
<el-row>
    <el-col :span="24">
        <div id="test" style="width:100%"></div>
    </el-col>
</el-row>
</template>

<script>
export default {
    name: "Pie",
    methods: {
        loadData() {

            this.axios.get("/api/data/pie").then((res) => {
                let list = res.data.data;
                let arr = [];
                for (var key in list) {
                    let value= list[key]
                    arr.push({
                       value:value,
                       name:key
                    })
                }
                this.$chart.Pie("test",arr); //方法调用
                this.$message({
                    message: "请求成功",
                    type: "success",
                });
                this.loading = false;
            });
        },
    },
    mounted() {
        this.loadData();
    }
};
</script>

<style scoped>
#test {
    width: 100%;
    height: 80vh;
}
</style>
